import { SkillMainPanel } from "../SkillMainPanel";
import { SkillRuneMapPanel } from "./SkillRuneMapPanel";
import { SkillRuneEvent } from "./SkillRuneEvent";
import { SkillRuneInfoPanel } from "./SkillRuneInfoPanel";
import { Language } from "../../../../../extend/language/Language";
import { ObjCreate } from "../../common/ObjCreate";
import { GTextFormat } from "../../../../common/GTextFormat";
import { RuneMapPanel } from "./RuneMapPanel";
import { SkillRuneItem } from "./SkillRuneItem";
import { SPlayerRuneInfo } from "../../../../../Message/Game/SPlayerRuneInfo";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
type int = number;
//class SkillRunePanel
    
    export  class SkillRunePanel extends SkillMainPanel
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ creatChirldren(): void
        {
            super.creatChirldren();
            _skillList = new SkillRuneMapPanel();
            addChild(_skillList);
            _skillList.addEventListener(SkillRuneEvent.RuneItemSelect, this.onRuneItemSelect);
            _skillInfo = new SkillRuneInfoPanel();
            addChild(_skillInfo);
            var loc1="<a href=\'event:\'><u>" + Language.getString(61500) + "</u></a>";
            this._runeMapLink = ObjCreate.createGTextField("", 243, 144, 220, 20, this, new GTextFormat(null, 12, 16776960));
            this._runeMapLink.autoSize = flash.text.TextFieldAutoSize.RIGHT;
            this._runeMapLink.addEventListener(flash.events.TextEvent.LINK, this.onRuneMapLinkClick);
            this._runeMapLink.htmlText = loc1;
            return;
        }

        /* internal  */onRuneMapLinkClick(arg1): void
        {
            if (this._runeMapPanel && this._runeMapPanel.parent) 
            {
                this.hideRuneMapPanel();
            }
            else 
            {
                this.showRuneMapPanel();
            }
            return;
        }

        public showRuneGetWin(): void
        {
            (_skillInfo as SkillRuneInfoPanel).showRuneGetWin();
            return;
        }

        public showRuneMapPanel(): void
        {
            if (!this._runeMapPanel) 
            {
                this._runeMapPanel = new RuneMapPanel();
                this._runeMapPanel.x = 488;
                this._runeMapPanel.y = -35;
            }
            this.addChild(this._runeMapPanel);
            (_skillInfo as SkillRuneInfoPanel).hideRunePackWindow();
            return;
        }

        public hideRuneMapPanel(): void
        {
            if (this._runeMapPanel && this._runeMapPanel.parent) 
            {
                this._runeMapPanel.parent.removeChild(this._runeMapPanel);
            }
            return;
        }

        protected onRuneItemSelect(arg1: SkillRuneEvent): void
        {
            var loc1=arg1.data as SkillRuneItem;
            (_skillInfo as SkillRuneInfoPanel).updateRuneData(loc1.pos, loc1.runeItemData);
            return;
        }

        protected /* override */ updateSize(): void
        {
            _skillList.x = 0;
            _skillList.y = 0;
            _skillInfo.x = 256;
            _skillInfo.y = 0;
            return;
        }

        public updateBackpackRune(): void
        {
            (_skillInfo as SkillRuneInfoPanel).updateBackpackRune();
            return;
        }

        public updateExtraNum(arg1: SPlayerRuneInfo): void
        {
            (_skillList as SkillRuneMapPanel).updateExtraNum(arg1);
            return;
        }

        public updateRuneData(): void
        {
            (_skillList as SkillRuneMapPanel).updateRuneData();
            return;
        }

        public set selectIndex(arg1: int)
        {
            (_skillList as SkillRuneMapPanel).selectIndex = arg1;
            return;
        }

        public showPackRune(): void
        {
            (_skillInfo as SkillRuneInfoPanel).showRunePackWindow();
            return;
        }

        /* internal */ /* var */_runeMapLink: GTextFiled;

        /* internal */ /* var */_runeMapPanel: RuneMapPanel;
    }
